<?php
/**
	 * Solid Chat For Elgg
	 * 
	 * @package solidchat
	 * @author Arunoda Susiripala
	 * @copyright Arunoda Susiripala 2009
	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
	 * @link http://elgg-solid-chat.googlecode.com
	 */

/**
 * The Message class which contains all the information related to chatMessage
 *
 */
class ChatMessage{
	public $owner;
	public $id;
	public $message;
	public $timestamp;

	public function __construct($id,$owner,$message,$timestamp){
		$this->id=$id;
		$this->owner=$owner;
		$this->message=$message;
		$this->timestamp=$timestamp;
	}
	
	public function toJSON(){
		return json_encode($this->toArray());
	}
	
	public function toArray(){
		$arr=array(
			"owner"=>$this->owner,
			"id"=>$this->id,
			"message"=>$this->message,
			"timestamp"=>$this->timestamp
		);
		
		return $arr;
	}
}